package com.by.wechatsend;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class read {
    public static String getRead() {

        BufferedReader bf = null;
        StringBuffer sb = new StringBuffer();
        try {
            bf = new BufferedReader(new FileReader("C:\\Users\\baiyu\\晚安语录.txt"));
            String s = null;
            while ((s = bf.readLine()) != null) {
                sb.append(s.trim());
            }

        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            //关闭流
            if (bf != null) {
                try {
                    bf.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        //将StringBuffer转换为String并返回
        return sb.toString();
    }
}